/*
 *英才会硕信息科技有限公司拥有本软件的版权，拥有本软件版权2025   并保留所有权利。
 *Copyright 2021,YCHS Information&Science Technology Co.,Ltd,
 *All rights reserved.
 */
package com.ychs.lawyerback01.mapper;

import com.ychs.lawyerback01.pojo.MenuEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.lang.Long;
import java.util.List;

/**
 * @author xuehongjin
 * @version 1.0
 * @date 2025/8/14
 */
@Mapper
public interface MenuMapper {

    List<String> getPermissions(Long roleId);

    @Select("SELECT m.* FROM privilege p LEFT JOIN menu m " +
            "ON p.menuId = m.menuId WHERE p.roleId = #{roleId} " +
            "AND (m.menuType = 'D' OR m.menuType = 'M') " +
            "AND m.menuFlag = 1 " +
            "AND p.menuId IS NOT NULL")  // 确保有关联的菜单
    List<MenuEntity> getMenusByRoleId(Long roleId);


    List<MenuEntity> selectAll();
}
